File file = new File(this.args[0])
String SUFFIX = "cp"

file.eachFile {
	if(it.absolutePath.endsWith("$SUFFIX")){

		String patch = it.absolutePath.split("\\.")[0] + ".patch"
		println "decode $patch ..."
		
		File f = new File(patch)
		def writer = f.newPrintWriter("UTF-8")
		
		it.readLines("UTF-8").each{
			writer.write(new String(it.decodeBase64(), "UTF-8") + "\n")
		}
		
		writer.flush()
		writer.close()

		//print "press enter key to continue ..."
		//System.in.read()
	}
}

